import heapq
class SeatManager(object):

    def __init__(self, n):
        """
        :type n: int
        """
        self.booked = [0] * n
        self.st = [i for i in range(n)]

    def reserve(self):
        """
        :rtype: int
        """
        id = heapq.heappop(self.st)
        self.booked[id] = 1
        return id + 1


    def unreserve(self, seatNumber):
        """
        :type seatNumber: int
        :rtype: None
        """
        self.booked[seatNumber - 1] = 0
        heapq.heappush(self.st, seatNumber - 1)
